﻿@namespace SwashbucklerDiary.Components
@inherits FocusDialogComponentBase

<MMDialog MyValue="Value"
          MyValueChanged="InternalValueChanged"
          MaxWidth="420"
@ref="myDialog">
    <MCard Rounded="@("lg")">
        <MCardTitle Class="font-weight-bold">
            @Title
            <MSpacer></MSpacer>
            <MButton Icon
                     OnClick="HandleOnCancel">
                <MIcon>mdi-close</MIcon>
            </MButton>
        </MCardTitle>
        <MCardText Class="pb-0">
            <MTextField @bind-Value="InputText"
            @ref="TextField"
                        OnKeyDown="HandleOnEnter"
                        Dense
                        HideDetails="@("auto")"
                        Outlined
                        Counter="@MaxLength"
                        maxlength="@MaxLength"
                        spellcheck="false"
                        Placeholder="@Placeholder"
                        AppendIcon="@PasswordIcon"
                        Type="@PasswordType"
                        OnAppendClick="() => showPassword = !showPassword">
            </MTextField>
        </MCardText>
        <MCardActions>
            <MSpacer></MSpacer>
            <MButton Text
                     OnClick="HandleOnCancel">
                @(I18n.T("Share.Cancel"))
            </MButton>
            <MButton Text
                     Color="primary"
                     OnClick="HandleOnOK">
                @(OKText ?? I18n.T("Share.Save"))
            </MButton>
        </MCardActions>
    </MCard>
</MMDialog>